package com.mooc;

import net.bytebuddy.implementation.bind.annotation.AllArguments;
import net.bytebuddy.implementation.bind.annotation.Origin;
import net.bytebuddy.implementation.bind.annotation.RuntimeType;
import net.bytebuddy.implementation.bind.annotation.SuperCall;

import java.lang.reflect.Method;
import java.util.concurrent.Callable;

public class AnimalWaterInterceptor {
    @RuntimeType
    public static Object intercept(@Origin Method method,
                                   @SuperCall Callable callable,
                                   @AllArguments Object[] objects) throws Exception {
        System.out.println("add the water before eat");
        Object object = callable.call();
        System.out.println("add the water after eat");
        return object;
    }
}
